<template>
  <div class="navigation-container">
    <div class="header-box">
      <div class="content">
        <div class="title">{{ globalConfig.fullName }}医务管理网上办事大厅欢迎你！</div>
        <div class="title">{{ globalConfig.fullName }}医务一网通办</div>

      </div>
    </div>

    <!-- 常见服务 -->
    <div class="middle">
      <div class="flex align-center">
        <div class="line mr10" />
        <div class="title">综合办事</div>
      </div>

      <div class="card-list flex flex-row align-center">
        <div class="flex flex-row align-center width300">
          <div class="card-box flex flex-row align-center" @click="goApp('医疗技术管理平台', 'xjsxxm', '/project/apply')">
            <img src="@/assets/008.png" alt="">
            <div class="flex-auto pl30">
              <div class="title">医疗技术管理平台</div>
              <div class="label mt10">上报新技术新项目</div>
            </div>
          </div>

        </div>
        <div class="flex flex-row align-center width300">
          <div class="card-box flex flex-row align-center" @click="goApp('不安全事件系统', 'baqsj', '/baqsj/report')">
            <img src="@/assets/u9.png" alt="">
            <div class="flex-auto pl30">
              <div class="title">不安全事件管理</div>
              <div class="label mt10">上报不安全事件</div>
            </div>
          </div>

        </div>
        <div class="flex flex-row align-center width300">
          <div class="card-box flex flex-row align-center" @click="goThird('wjz')">
            <img src="@/assets/wjz.png" alt="">
            <div class="flex-auto pl30">
              <div class="title">危急值管理</div>
              <div class="label mt10" />
            </div>
          </div>
        </div>
        <div class="flex flex-row align-center width300">
          <div class="card-box flex flex-row align-center" @click="goApp('投诉纠纷管理平台', 'complaints', '/complaints/dashboard')">
            <img src="@/assets/ts.png" alt="">
            <div class="flex-auto pl30">
              <div class="title">投诉纠纷管理平台</div>
              <div class="label mt10" />
            </div>
          </div>
        </div>

      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { initData } from '@/api/dashboard'
import { workOrderList } from '@/api/xjs/ns-order'
import { workOrderTodoList } from '@/api/xjs/work-order'
export default {
  name: 'Navigation',
  components: {},
  data() {
    return {
      dashboardValue: {
        count: {}
      },
      ticketList: [],
      todoList: [],
      nsCount: 0,
      affirmCount: 0,
      todoCount: 0,
      queryList: {},
      listQuery: {
        page: 1,
        per_page: 1000
      },
      listTodoQuery: {
        page: 1,
        per_page: 1000
      }
    }
  },
  computed: {
    ...mapGetters(['avatar', 'device', 'name', 'roles', 'globalConfig'])
  },
  created() {
  },
  methods: {
    getMyTodoList() {
      this.listTodoQuery.classify = 1
      workOrderTodoList(this.listTodoQuery).then(response => {
        this.todoList = response.data.data
        this.todoCount = response.data.total_count
      })
    },
    getMyNsList() {
      this.listQuery.classify = 1
      this.listQuery.process = 2
      this.listQuery.nodeName = '阶段评审填报'
      workOrderList(this.listQuery).then(response => {
        this.ticketList = response.data.data
        this.nsCount = response.data.total_count
      })
    },
    getMyAffirmList() {
      this.listQuery.classify = 1
      this.listQuery.process = 2
      this.listQuery.nodeName = '阶段评审确认'
      workOrderList(this.listQuery).then(response => {
        this.affirmCount = response.data.total_count
      })
    },
    getInitData() {
      initData(this.queryList).then(response => {
        this.dashboardValue = response.data
      })
    },
    goThird(type) {
      if (type === 'wjz') {
        window.open('http://10.40.21.76:8901/webdp')
      }
    },
    goAdmin() {
      localStorage.setItem('currentApp', JSON.stringify({ name: '领导驾驶舱', mid: 'admin' }))
      this.$router.push({ path: '/project/apply' })
    },
    goApp(name, mid, url) {
      localStorage.setItem('currentApp', JSON.stringify({ name: name, mid: mid }))
      this.$router.push({ path: url })
    },
    goProfile() {
      this.$router.push({ path: '/profile/index' })
    },
    async logout() {
      this.$confirm('确定注销并退出系统吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$store.dispatch('user/LogOut').then(() => {
          location.reload()
        })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.navigation-container {
    .header-box {
        background: url("~@/assets/navigation-top.jpg") no-repeat 100%;
        width: 100%;
        height: 250px;
        background-size: cover;
        position: relative;

        .mask {
            position: absolute;
            width: 100%;
            height: 250px;
            background: rgba(0, 0, 0, 0.6);
        }

        .content {
            color: #fff;
            padding-left: 50px;
            padding-top: 30px;

            .title {
                font-size: 28px;
                margin-bottom: 15px;
            }

            .card {
                width: 250px;
                height: 100px;
                background: #fff;
                margin-right: 30px;
                border-radius: 10px;
                padding: 10px;
                align-items: center;
                color: #000;
                position: relative;
                top: 0;
                right: 0;
                transition: 0.2s all ease;

                img {
                    width: 80px;
                    height: 63px;
                }

                &:hover {
                    top: -3px;
                    right: -1px;
                    -webkit-box-shadow: 0 15px 30px 0 rgb(255 255 255 / 30%);
                    box-shadow: 0 15px 30px 0 rgb(255 255 255 / 30%);
                    cursor: pointer;
                }

                .number {
                    color: red;
                    font-size: 28px;
                    font-weight: 600;
                }

                .label {
                    font-size: 17px;
                    font-weight: 600;
                }
            }
        }
    }

    .middle {
        padding: 10px 5px;
        margin-top: 10px;

        .title {
            font-size: 20px;
            font-weight: 600;
            color: rgba($color: #000000, $alpha: 0.65);
        }

        img {
            width: 50px;
            height: 50px;
        }

        .card-box {
            background: #fff;
            border-radius: 10px;
            margin: 20px 30px 10px 0px;
            padding: 20px 10px;
            position: relative;
            top: 0;
            -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.2);
            box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.2);
            right: 0;
            flex: 1;
            transition: 0.2s all ease;

            .title {
                font-size: 18px;
                font-weight: bold;
                color: #263238;
            }

            .label {
                font-size: 15px;
                color: #97a2b0;
            }

            &:hover {
                top: -3px;
                right: -1px;
                -webkit-box-shadow: 0 7px 15px 0 rgb(0 0 0 / 20%);
                box-shadow: 0 7px 15px 0 rgb(0 0 0 / 20%);
                cursor: pointer;
            }
        }
    }
}
</style>
